<template>
  <div id="app">
    <!-- <ConfirmBoxDialog></ConfirmBoxDialog> -->
    <button @click="change">点击购买</button>
  </div>
</template>

<script>
import CAdPay from "../../src/c-ad-pay/index.vue";
import AdBuy from "../../src/c-ad-pay/buy";

import  AdConfirmBoxDialog  from "../../src/c-ad-pay/components/ConfirmBox/index"
export default {
  // components: { CAdPay,ConfirmBoxDialog },
   created() {
    console.log('落地页支付');
  },
  mounted(){
    // setTimeout(()=>{
    //   new AdConfirmBoxDialog().perform({
    //     isAutoSkip:false
    //   })
    // },1000)
    this.gobuy()

  },
  data(){
    return{
      resolve:null
    }
  },

  methods:{
    change(){
      this.resolve()
    },
    gobuy(){
      const info =  new AdBuy(
      {
        spu_id: 'i_668501dfe4b0694c983ae018',
        sku_id: 'SKU_ITX_7199927990680bZSph33',
      },
      {
        redirectUrl:'https://www.baidu.com/',
        paySuccessUrl: 'https://www.baidu.com/',
        payFailUrl: 'https://www.youtube.com/'
      },
      {
        click_id:'',
        ad_page_id: '',
        link_user_id:"12123",
        scrm_link_id:'',
        scrm_clue_id:'',
        channel_type:0,
        from_ads: true, //是否是广告页面
        isTourist: 0 // 是否是游客身份  0否 1是
      },false)
       const option = () => new Promise((resolve) => {
          this.resolve = resolve
       })

       //支付弹窗
       info.getPayWay({ option }).then(({token, payWay, showSelectPayWay})=>{
          console.log(showSelectPayWay)
         if(showSelectPayWay === 2){
          //  alert('关闭了')
         }else{
           //下单支付
           info.perform({ token, payWay})
         }
       })
      console.log(info, 222);
    }
  }
};
</script>

<style lang="scss">
html {
  font-size: 50px;
}
</style>
